package com.xbongbong.saas.domain.entity;

import com.xbongbong.paas.toolbox.util.DateUtil;
import com.xbongbong.sys.domain.entity.UserEntity;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

/**
 * @author chenshan
 * @version 1.0
 * @date 2020-08-31
 * @since 钉钉群成员表
 */
@Setter
@Getter
@ToString
public class DingBundleUserEntity {
    private static final long serialVersionUID = -8164395867653509756L;
    private Long id;
    private String corpid;
    /**
     * 群编号
     */
    private String openConversationId;
    /**
     * 系统群编号
     */
    private Long bundleId;
    /**
     * 群用户编号
     */
    private String userId;
    /**
     * unionid
     */
    private String unionid;
    /**
     * 群成员头像
     */
    private String avatar;
    /**
     * 群成员姓名
     */
    private String name;
    /**
     * 0:群主，
     * 1:群管理员。
     * 2:群成员
     */
    private Integer identity;
    /**
     * 新增时间
     */
    private Long addTime;
    /**
     * 更新时间
     */
    private Long updateTime;
    /**
     * 是否删除
     */
    private Integer del;
    
    public DingBundleUserEntity() {
        long now = DateUtil.getLong();
        addTime = now;
        updateTime = now;
        del = 0;
    }
    
    public DingBundleUserEntity(Long bundleId, String corpid, String openConversationId, UserEntity userEntity) {
        this.avatar = userEntity.getAvatar();
        this.name = userEntity.getName();
        this.userId = userEntity.getUserId();
        this.identity = 2;
        this.corpid = corpid;
        this.openConversationId = openConversationId;
        this.bundleId = bundleId;
        long now = DateUtil.getLong();
        this.addTime = now;
        this.updateTime = now;
        this.del = 0;
    }
}
